function sub(infoId){
    var content = $("#texta").val();
    var date = new Date();
    var now = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate()+" "+date.getHours()+":"+date.getMinutes()+":"+date.getSeconds();
    var data = {
        infoid: infoId,
        content: content,
        replytime: now
    };
    $.ajax({
        url: "add",
        data: JSON.stringify(data),
        contentType: "application/json;charset=utf-8",
        type: "post",
        dataType: "json",
        success: function (data){
            if (data.code == 200){
                var c = $("#content");
                if ($("#null").get(0)!=null){
                    $("#null").remove();
                }
                var p = $("<p class='rep'>"+data.content.replytime+"<br>"+data.content.content+"</p>");
                c.append(p);
            }else if(data.code == 300){
                alert(data.msg);
            }


        }
    })
}

$("#texta").keyup(function (){
    var number = 200-$("#texta").val().length;
    if (number<=200 && number>=1){
        $("#msg").css("color","black");
        $("#msg").text("你还可写"+number+"字");
        $("#btn").removeAttr("disabled");
    }else{
        $("#msg").css("color","red");
        $("#msg").text("内容不得超过200字！");
        $("#btn").attr("disabled","disabled");
    }
});